import { createRouter, createWebHistory } from "vue-router";

const routes = [
  {
    path: "/layout", name: "layout", component: () => import("@/layout/index.vue"),
    children: [
      {
        path: "/echarts", // 默认子路由，对应/layout路径
        name: "echarts",
        component: () => import("@/views/echarts/index.vue")
      }
    ]
  },
  { path: "/", name: "/", component: () => import("@/views/home/index.vue") },
  { path: "/about", name: "/about", component: () => import("@/views/about/index.vue") },
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: () => import("@/views/404.vue")
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router
